using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

using System.Data.Entity;
using System.Data.Common;
using System.Data.Objects;

namespace DemoApp.DataAccess 
{
  public partial class DemoAppModelDbContext : DbContext
  {
    static DemoAppModelDbContext()
    {
      Database.SetInitializer<DemoAppModelDbContext>(new DemoAppModelDbContextInitializer());
    }

    #region [ Constructors ]
    public DemoAppModelDbContext()
    {
  
    }

    public DemoAppModelDbContext(string nameOrConnectionString)
      : base(nameOrConnectionString)
    {
  
    }

    public DemoAppModelDbContext(DbConnection existingConnection, bool contextOwnsConnection)
      : base(existingConnection, contextOwnsConnection)
    {

    }

    public DemoAppModelDbContext(ObjectContext objectContext, bool dbContextOwnsObjectContext)
      : base(objectContext, dbContextOwnsObjectContext)
    {

    }
    #endregion [ Constructors ]

    #region [ Entity Sets ]
    public DbSet<Role> Roles { get; set; }

    public DbSet<SecurableAction> SecurableActions { get; set; }

    public DbSet<User> Users { get; set; }

    public DbSet<Subject> Subjects { get; set; }

    public DbSet<Favorite> Favorites { get; set; }

    #endregion [ Entity Sets ]

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
      base.OnModelCreating(modelBuilder);

      modelBuilder.Configurations.Add<Role>(new RoleEntityConfiguration());
      modelBuilder.Configurations.Add<SecurableAction>(new SecurableActionEntityConfiguration());
      modelBuilder.Configurations.Add<User>(new UserEntityConfiguration());
      modelBuilder.Configurations.Add<Person>(new PersonEntityConfiguration());
      modelBuilder.Configurations.Add<Group>(new GroupEntityConfiguration());
      modelBuilder.Configurations.Add<Subject>(new SubjectEntityConfiguration());
      modelBuilder.Configurations.Add<Favorite>(new FavoriteEntityConfiguration());
      modelBuilder.Configurations.Add<FavoriteDerived>(new FavoriteDerivedEntityConfiguration());
    }
  }
}
